package com.ming.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ming.domain.HotSearch;
import com.ming.sevice.HotSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:何元才
 * @Desc:
 * @data:2021-04-02 17:22
 */
@RestController
@RequestMapping("/admin/hotSearch")
@Api(tags = "热搜管理接口")
public class HotSearchController {

    @Autowired
    private HotSearchService hotSearchService;


    /**
     * 分页查询热搜
     *
     * @param page
     * @param hotSearch
     * @return
     */
    @GetMapping("page")
    @ApiOperation("分页查询热搜")
    @PreAuthorize("hasAuthority('admin:hotSearch:page')")
    public ResponseEntity<Page<HotSearch>> findNoticePage(Page<HotSearch> page,HotSearch hotSearch){
        Page<HotSearch> hotSearchPage = hotSearchService.findNoticePage(page,hotSearch);
        return ResponseEntity.ok(hotSearchPage);
    }
}
